package com.mszlu.blog.controller;

import com.mszlu.blog.service.TagService;
import com.mszlu.blog.vo.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author linKe
 * 比起爱你控制器
 */
@RestController
@RequestMapping("tags")
public class TagsController {
    @Resource
    private TagService tagService;

    /**
     * 查询最热标签  访问路径 /tags/hot
     * @return  tagService.hots(limit)
     * @Author linKe
     * @Date 2021/12/5 11:01
     */

    @GetMapping("hot")
    public Result hot(){
        int limit = 6;
        return tagService.hots(limit);
    }


    @GetMapping
    public Result findAll(){
        return tagService.findAll();
    }


    @ApiOperation("导航切换的标签分类")
    @GetMapping("detail")
    public Result findAllDetail(){
        return tagService.findAllDetail();
    }

    @ApiOperation("标签id查询详情信息")
    @GetMapping("detail/{id}")
    public Result findDetailById(@PathVariable("id") Long id){
        return tagService.findDetailById(id);
    }

}
